//
//  PicFooterView.m
//  FlowerRainGround
//
//  Created by zfc on 16/4/20.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "PicFooterView.h"
#import "RecommendModel.h"
#import "DetailPostViewController.h"

@implementation PicFooterView


- (instancetype)initWithFrame:(CGRect)frame {
    if(self = [super initWithFrame:frame]) {
        
    }
    return self;
}

- (IBAction)Push:(id)sender {
    
     DetailPostViewController *detailVC = [[DetailPostViewController alloc] init];
  
    if ([[[self viewController] class] isEqual:[detailVC class]]) {
        return;
    } else {
        [[self viewController] presentViewController:detailVC animated:YES completion:nil];
        
        
    }
    
}


//点击button的时候跳转到控制器上，通过响应者找到这个控制器
- (UIViewController *)viewController {
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponder;
        }
    }
    return nil;
}



+ (instancetype)footerView{
    return [[[NSBundle mainBundle]loadNibNamed:@"PicFooterView" owner:nil options:nil]lastObject];
}


@end
